﻿using Microsoft.Extensions.Configuration;

namespace WXWorkSvc.Third;

public class WXWork3rdConfig
{
    public const string SectionName = "WXWork3rd";
    public string SuiteId { get; set; } = default!;
    public string AuthSuiteId { get; set; } = default!;
    public string ApplicationUrl { get; set; } = default!;

    public WXWork3rdConfig() { }
    public WXWork3rdConfig(IConfiguration configuration)
    {
        var c = configuration.GetSection(SectionName).Get<WXWork3rdConfig>();
        if (c == null)
            throw new Exception("请在 appsettting.json 设置 WXWork3rd");
        ApplicationUrl = c.ApplicationUrl;
        SuiteId = c.SuiteId;
        AuthSuiteId = c.AuthSuiteId;
    }
}
